// pages/article/article.js
const {artHttp} = require("../../models/article")
Page({
  data: {
    images:[],
    swiperParams:{
      defaultColor:"#666",
      dots:true,
      activeColor:"#333",
      autoplay:true,
      circular:true
    },
    result:""
  },
  onShow: function (options) {
    artHttp().then(res=>{
      var result = res.data.res
        var images=[]
        result.forEach(item=>{
          images.push(
            item.headImgSrc
          )
        })
        this.setData({
          images:images.slice(0,3),
          result
        })
    })
  },
  handleDetail(event){
    var {id} = event.currentTarget.dataset
    wx.navigateTo({
      url: `/pages/artDeatil/artDetail?id=${id}`
    });
  }
})